using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;  
using System.Text;

namespace Rest
{
    /// <summary>
    /// Collection class for RestParameter types
    /// </summary>
    public class RestParameterCollection : List<IRestParameter>
    {
        /// <summary>
        /// Creates a new RestParameter with the supplied name and value, and adds
        /// it to the list.
        /// </summary>
        /// <param name="name">Parameter name</param>
        /// <param name="value">Parameter value</param>
        public void Add(String name, String value)
        {
            Add(new RestParameter(name, value));
        }

        /// <summary>
        /// Adds the parameters from the supplied collectio
        /// </summary>
        /// <param name="parameters"></param>
        public void Add(RestParameterCollection parameters)
        {
            foreach (RestParameter parameter in parameters)
            {
                Add(parameter);
            }
        }

        /// <summary>
        /// Adds the parameters from the supplied NameValueCollection
        /// </summary>
        /// <param name="parameters"></param>
        public void Add(NameValueCollection parameters)
        {
            foreach (String key in parameters)
            {
                Add(key, parameters[key]);
            }
        }
    }
}
